<template>
  <div class="box">
    <!-- 项目需求 -->
    <div class="conditionsTxt demandbox">
        <h3>
            <p>编号</p>
            <p>字段</p>
            <p>用户需求</p>
        </h3>
        <el-collapse v-model="activeDemand">
            <el-collapse-item :title="dem.group" :name="index" v-for="(dem,index) in demand" :key="index">
                <ul>
                <li v-for="(cont,index) in dem.children" :key="index">
                    <i>{{cont.no > 9 ? cont.no : "0" + cont.no}}</i>
                    <p>{{cont.field}}</p>
                    <p>{{cont.value}}</p>
                </li>
                </ul>
            </el-collapse-item>
        </el-collapse>
    </div>
    <!-- 项目需求抽屉 -->
    <!-- 编辑项目需求 抽屉 -->
    <el-drawer
        title="编辑需求"
        size="40%"
        @close='demandClose'
        :visible.sync="demandDrawer">
        <div class="conditionsTxt pd20 drawerBox demandDrawer">
        <h3>
            <p>删除</p>
            <p>编号</p>
            <p>字段</p>
            <p>说明</p>
        </h3>
        <div class="mb60">
          
          <el-tree
            :allow-drop="canDrag"
            :data="demand"
            @node-drop="handleDrop"
            node-key="id"
            default-expand-all
            :expand-on-click-node="false"
            draggable>
            <span class="custom-tree-node" slot-scope="{ node, data }">
              <i
                class="el-icon-remove"
                v-if="data.isPid"
                @click="removeXqgroup(data)"
              ></i>
              <i class="el-icon-remove" v-else @click="removeXqList(data)"></i>
              <p class="treeNum" v-if="!data.isPid">
                {{ data.no > 9 ? data.no : "0" + data.no }}
              </p>
              <el-input v-model="data.group" v-if="data.isPid" @input="editGroupInput(data)" class="groupInput"></el-input>
              <el-input v-model="data.field" v-if="!data.isPid" @input="editInput(data)"></el-input>
              <el-input v-model="data.describable" v-if="!data.isPid" @input="editInput(data)"></el-input>
              
              <!-- 添加图标 -->
              <p class="drawerAdd" v-if="data.isPid">
                <svg-icon icon-class="add-icon" @click="addXqList(data)" />
              </p>
            </span>
          </el-tree>

        </div>
        <SubBtn>
            <template slot="btn">
              <el-button round @click="addXqGroup">添加流程组</el-button>
              <el-button type="primary" round @click="saveBtn" :disabled="!isCheck">保存</el-button>
            </template>
        </SubBtn>
        </div>
    </el-drawer>
    <!-- 编辑项目需求 end -->
    <SubBtn>
        <template slot="btn">
          <p class="record" @click="clickRecord">更改记录 <i class="el-icon-document"></i></p>
          <el-button round @click="demandClick">编辑需求字段</el-button>
          <!-- <el-button type="primary" round @click="saveBtn">更新需求字段</el-button> -->
        </template>
    </SubBtn>
  </div>
</template>

<script>
import SubBtn from "@/wss/components/subBtn.vue";

import {switchTree} from "@/wss/utils/wss.js";
import { 
  getProjectNeedsListApi,
  addProjectNeedsApi,
  editProjectNeedsApi,
  removeProjectNeedsApi
} from "@/wss/newApi_3-24/work/projectNeeds.js";
import { editProjectApi } from "@/wss/newApi_3-24/doc/project.js"
import debounce from "lodash/debounce";
export default {
  components:{SubBtn},
  props:{
    projectData: {
      type: Object,
      default: () => {
          return {};
      },
    },
  },
  data(){
      return{
        //当前激活的项目需求
        activeDemand: [],
        // 编辑项目需求抽屉
        demandDrawer:false,
        //判断当前的抽屉是点保存关闭还是普通关闭
        saveClose: false,
        isSend: false,//点击保存时判断当前的输入的是正确的数据

        temArray:[],//暂存的数组 
        // 项目需求数据
        demand:[],
        //项目类型id
        typeId: "",

        //当前删除的id组
        removeId:[],
        //当前添加的条件
        addTj:[],
        //修改项目条件
        editTj:[],
        isCheck: true,// 判断当前点击保存是否已经返回请求
      }
  },
  mounted(){
    // this.getProjectNeedsList(); //获取项目需求

    // 获取项目条件：根据no字段排序
    let arr = this.projectData.needs.sort((a, b) => Number(a.no)- Number(b.no))
    // 转换树形结构
    this.demand = switchTree(arr);

    // 默认展开所有折叠面板 activeDemand
    this.demand.forEach((item,i)=>{
      this.activeDemand.push(i)
    })
  },
  watch:{
    //监听项目的数据是否有更新，更新的话就重新获取项目信息
    projectData(newValue,oldValue){
      // this.getProjectNeedsList(); //获取项目需求
      // 获取项目条件：根据no字段排序
      let arr = this.projectData.needs.sort((a, b) => Number(a.no)- Number(b.no))
      // 转换树形结构
      this.demand = switchTree(arr);

      // 默认展开所有折叠面板 activeDemand
      this.demand.forEach((item,i)=>{
        this.activeDemand.push(i)
      })
    },
  },
  methods:{
    // 拖拽时判定目标节点能否被放置
    canDrag(draggingNode, dropNode, type) {
      
      if (draggingNode.level == '1' || !draggingNode.data.isEdit) {
        return false
      } else {
        if(draggingNode.level==dropNode.level){
          //组中只剩一个的时候不能拖拽
          if(draggingNode.parent.data.children.length==1){
            return false
          }else{
            return type==="prev" || type==="next"
          }
          //组中只剩一个的时候不能拖拽 end
        }else if(draggingNode.level==dropNode.level+1){
          return type==='inner'
        }else{
          return false
        }
      }
      
    },

    //获取项目需求
    async getProjectNeedsList() {
      let result = await getProjectNeedsListApi();
      if (result.code == 200) {
        //根据no字段排序
        let arr = result.rows.sort((a, b) => Number(a.no)- Number(b.no))
        // 转换树形结构
        this.demand = switchTree(arr);
        // console.log(this.demand);

        // 默认展开所有折叠面板 activeDemand
        this.demand.forEach((item,i)=>{
          this.activeDemand.push(i)
        })
      }
    },

    //拖拽成功完成时的事件 draggingNode拖拽节点 dropNode进入的节点 dropType放置位置 ev是event
    handleDrop(draggingNode, dropNode, dropType, ev) {
      //修改拖拽后的group为目标节点的group
      draggingNode.data.group = dropNode.data.group
      
      // 拖拽之后的数字no要改变 ************************
      let newStep = []
      //把所有子项转成一整个数组
      this.demand.forEach(item=>{
        newStep = [...newStep,...item.children]
      })
      //把下标+1重新赋值给所有子项no
      for(let i=0;i<newStep.length;i++){
        newStep[i].no = (i+1)
      }
      // 把全部子项给到修改组里面
      newStep.forEach(item=>{
        // 有id才加进去
        if(item.id){
          this.editTj.push(item)
        }
      })
      // 拖拽之后的数字no要改变 ************************end
    },

    //修改组的组名的时候，下面的子元素都要把组名改了
    editGroupInput(data){
      data.children.forEach((item)=>{
        item.group = data.group
      })
      // 去掉重复的
      data.children.map(item=>{ 
        this.editTj = this.editTj.filter(item2 => {
          item2.id != item.id
        });
      })
      //把当前修改的添加到修改数据里面
      this.editTj = [...this.editTj,...data.children]
    },

    //修改input框的时候
    editInput(data){
      //判断修改的数据是否有重复的，删除重复的
      this.editTj.forEach(item=>{
        // 获得下标
        let index = this.editTj.indexOf(item);
        if(item.id == data.id){
          this.editTj.splice(index,1)
        }
      })
      //刚刚添加进去条件的不能当做修改的加入到修改组里面 通过id判断是否是刚刚加进去的
      if(data.id){
        //把当前修改的添加到修改数据里面
        this.editTj.push(data)
      }
    },

    // 计算组名能否被修改 children子元素有一个元素没有isEdit字段，就要改不能编辑
    getIsEdit(data){
      for (let i=0; i<data.children.length; i++) {
        if(!data.children[i].isEdit) return true
      }
    },

    // *****************项目需求****************
    //点击项目需求的操作
    demandClick(){
      this.saveClose = false //改成普通关闭状态
      this.isSend = false //点击保存时判断当前的输入的是正确的数据
      //显示项目需求的抽屉
      this.demandDrawer=true
      // 把数组先保存起来,关闭抽屉和取消的时候还原旧数据
      this.temArray =  JSON.parse(JSON.stringify(this.demand))
    },

    // 关闭项目条件的回调
    demandClose(){
      // 还原旧数据 普通关闭执行还原数据
      if(this.saveClose == false){
        this.demand = this.temArray;
      }
      //清空删除、添加、修改的数据
      this.removeId=[]//当前删除的数据
      this.addTj=[]//当前添加的数据
      this.editTj=[]//修改项目的数据
    },
    
    //删除需求的其中一组
    removeXqgroup(group){
      let demand = this.demand;
      if(group.id){
        // 当删除的这一条是有id的说明是已经添加的
        demand = demand.filter((item) => {
          return item.group != group.group;
        });
        this.demand = demand;
      }else{
        // 当删除的这一条是没有id的说明是新添加的
        demand.forEach((i) => {
          let index = demand.indexOf(group)
          if(i == group){
            demand.splice(index,1)
          }
        })
      }

      //获得当前删除组下的所有的id
      group.children.forEach(i=>{
        this.removeId.push(i.id)
      })

      //删除刚刚添加的一条的时候，把添加数据里面的那一条删掉
      this.addTj.forEach(item=>{
        // 获得下标
        let index = this.addTj.indexOf(item);
        if(item == group){
          this.addTj.splice(index,1)
        }
      })

      // 添加之后的数字no要改变 ************************
      let newStep = []
      //把所有子项转成一整个数组
      this.demand.forEach(item=>{
        newStep = [...newStep,...item.children]
      })
      //把下标+1重新赋值给所有子项no
      for(let i=0;i<newStep.length;i++){
        newStep[i].no = (i+1)
      }
      // 把全部子项给到修改组里面
      newStep.forEach(item=>{
        // 有id才加进去
        if(item.id){
          this.editTj.push(item)
        }
      })
      // 添加之后的数字no要改变 ************************end
    },

    // 删除条件的其中一条
    removeXqList(list){
      let demand = this.demand;
      if(list.id){
        // 当删除的这一条是有id的说明是已经添加的
        demand.forEach((i) => {
          i.children = i.children.filter((k) => {
            return k.id != list.id;
          });
        });
        this.demand = demand;
      }else{
        // 当删除的这一条是没有id的说明是新添加的
        demand.forEach((i) => {
          i.children.forEach((k)=>{
            // 获得下标
            let index = i.children.indexOf(list)
            if(k == list){
              i.children.splice(index,1)
            }
          })
        })
      }

      //获得当前删除的id
      this.removeId.push(list.id)
      //删除刚刚添加的一条的时候，把添加数据里面的那一条删掉
      this.addTj.forEach(item=>{
        // 获得下标
        let index = this.addTj.indexOf(item);
        if(item == list){
          this.addTj.splice(index,1)
        }
      })

      // 添加之后的数字no要改变 ************************
      let newStep = []
      //把所有子项转成一整个数组
      this.demand.forEach(item=>{
        newStep = [...newStep,...item.children]
      })
      //把下标+1重新赋值给所有子项no
      for(let i=0;i<newStep.length;i++){
        newStep[i].no = (i+1)
      }
      // 把全部子项给到修改组里面
      newStep.forEach(item=>{
        // 有id才加进去
        if(item.id){
          this.editTj.push(item)
        }
      })
      // 添加之后的数字no要改变 ************************end
    },

    //添加一条数据
    addXqList(data){
      //把数据里的no提取出来
      let noList = [];
      this.demand.forEach((item) => {
        if (item.no) {
          noList.push(parseInt(item.no));
        }
        if (item.children.length > 0) {
          item.children.forEach((c) => {
            if (c.no) {
              noList.push(parseInt(c.no));
            }
          });
        }
      });
      //获得最大的no 然后+1
      let maxNum = (parseInt(Math.max(...noList)) || 0) + 1;

      //添加一条数据
      data.children.push({
        group: data.group,
        describable: "",
        field:"",
        no: maxNum.toString(),
        // typeId: this.typeId,  
        isEdit: true,
      });

      //获得当前添加的这一个条件
      this.addTj.push(data.children[data.children.length-1])

      // 添加之后的数字no要改变 ************************
      let newStep = []
      //把所有子项转成一整个数组
      this.demand.forEach(item=>{
        newStep = [...newStep,...item.children]
      })
      //把下标+1重新赋值给所有子项no
      for(let i=0;i<newStep.length;i++){
        newStep[i].no = (i+1)
      }
      // 把全部子项给到修改组里面
      newStep.forEach(item=>{
        // 有id才加进去
        if(item.id){
          this.editTj.push(item)
        }
      })
      // 添加之后的数字no要改变 ************************end
    },
    //添加一组数据
    addXqGroup(){
      this.demand.push({
        children:[],
        group: "",
        isPid: true,
        typeId: this.typeId, 
      });

      //获得当前添加的这一个组
      // this.addTj.push(this.demand[this.demand.length-1])
    },

    // 点击保存按钮 ***************
    saveBtn: debounce(function() {
      //判断点击保存时的数据是否是正常的数据
      try {
        //当把数据全部删除的情况
        if (this.demand.length == 0) {
          // 条件改成通过
          this.isSend = true;
        }

        this.demand.forEach((item) => {
          if (item.children.length < 1) {
            this.$message({
              type: "warning",
              message: "组下面至少要有一个条件！",
            });
            throw new Error("组下面至少要有一个条件！");
          } else {
            if (item.isPid == true && item.group == "") {
              this.$message({ type: "warning", message: "组名不能为空" });
              throw new Error("组名不能为空");
            } else {
              item.children.forEach((c) => {
                if (c.field == "" || c.describable == "") {
                  this.$message({ type: "warning", message: "字段和说明不能为空" });
                  throw new Error("字段和说明不能为空");
                }
              });
              // 条件改成通过
              this.isSend = true;
            }
          }
        });
      } catch (e) {
        throw e.message
      };
      this.startRequest()// 发起 删除、添加、修改
    
    },1000),
    // 点击保存按钮 ***************end

    //如果条件是通过就要去发请求 ********************************
    async startRequest(){
      this.isCheck = false //先不给点击保存
      // 发起 删除、添加、修改
      if (this.isSend == true) {
        this.$message({ type: "success", message: "正在编辑，请稍等！" });
        
        let demand = JSON.parse(JSON.stringify(this.demand))
        let newArr = []
        demand.forEach(item=>{
          newArr = [...newArr,...item.children]
        })

        // 修改记录 *********
        let jlArr = []
        // 添加的
        let addTj = JSON.parse(JSON.stringify(this.addTj))
        addTj.forEach(item=>{
          item.changeType = '1' //1 添加 2 修改 3 删除
          item.type = '2' //1 条件 2 需求 3 流程
          item.newGroup = item.group
          item.newName = item.field
          item.newNo = item.no
          jlArr.push(item)
        })
        // 修改的
        let editTj = JSON.parse(JSON.stringify(this.editTj))
        editTj.forEach(item=>{
          if(item.id){
            item.changeType = '2' //1 添加 2 修改 3 删除
            item.type = '2' //1 条件 2 需求 3 流程
            item.newGroup = item.group
            item.newName = item.field
            item.newNo = item.no
            // 获取之前的 组名、名称、序号no
            let oldTem = []
            this.temArray.forEach(i=>{
              oldTem = [...oldTem,...i.children]
            })
            let oldItem = oldTem.filter(k=>{
              return k.id == item.id
            })
            item.oldGroup = oldItem[0].group
            item.oldName = oldItem[0].name
            item.oldNo = oldItem[0].no
            // 获取之前的 组名、名称、序号no end
            jlArr.push(item)
          }
        })
        // 删除的
        let removeId = JSON.parse(JSON.stringify(this.removeId))
        removeId.forEach(item=>{
          if(item){
            let reObj = {}
            reObj.changeType = '3' //1 添加 2 修改 3 删除
            reObj.type = '2' //1 条件 2 需求 3 流程
            // 获取之前的 组名、名称、序号no
            let oldTem = []
            this.temArray.forEach(i=>{
              oldTem = [...oldTem,...i.children]
            })
            let oldItem = oldTem.filter(k=>{
              return k.id == item
            })
            reObj.oldGroup = oldItem[0].group
            reObj.oldName = oldItem[0].field
            reObj.oldNo = oldItem[0].no
            
            jlArr.push(reObj)
          }
        })
        // 修改记录 ********* end

        await this.editProject(newArr,jlArr); //项目修改的接口
        this.$bus.$emit('retrieveItem') // 重新获取项目的信息
        this.addTj = []
        this.editTj = []
        this.removeId = []

        this.saveClose = true //改成保存关闭状态
        this.demandDrawer = false// 关闭抽屉
        this.isCheck = true //可以点击保存了
      }
    },
    //如果条件是通过就要去发请求 ******************************** end

    // *****************项目需求****************end
    // 项目修改的接口
    async editProject(newArr,jlArr){
      let data = {
        id: this.projectData.id,
        needs: newArr,
        changeHistories: jlArr,
      }
      let result = await editProjectApi(data)
      if(result.code == 200){
        this.$message({ type: "success", message: "保存成功！" });
      }
    },
    
    // 添加的接口
    async addProjectNeeds(data){
      let result = await addProjectNeedsApi(data)
      if(result.code==200){}
    },

    //修改的接口
    async editProjectNeeds(data){
      let result = await editProjectNeedsApi(data)
      if(result.code==200){}
    },

    //删除的接口
    async removeProjectNeeds(id){
      let result = await removeProjectNeedsApi(id)
      if(result.code==200){}
    },

    // 更改记录的抽屉按钮 ***************************
    clickRecord(){
        this.$bus.$emit('openRecordDrawer')
    },
  },
}
</script>

<style scoped>
h3,h4,p,ul,li{
  margin: 0;
  padding: 0;
  list-style: none;
}
.pd20{
  padding: 0 20px;
}
/* 右侧样式 */
::v-deep .top .right{
  flex: none;
}
.el-button-group .el-button{
  background-color: #F0F2F5;
  color: #2E3F5E;
  border: 1px solid #F0F2F5;
  padding: 10px 15px;
}
.el-button-group .el-button.isActive{
  background-color: #fff;
  color: #F87A23;
  font-weight: bold;
}

/* 项目条件 */
.conditionsTxt {
    margin-bottom: 60px;
}
.conditionsTxt h3{
  display: flex;
  font-size: 12px;
  font-weight: 600;
  color: #909AAA;
  /* border-bottom: 1px solid #EBEEF5; */
  padding-bottom: 15px;
  margin-top: 10px;
}
.conditionsTxt h3>p:first-child{
  width: 12%;
}
.conditionsTxt h3>p:nth-child(2){
  width: 76%;
}
.conditionsTxt h3>p:nth-child(3){
  width: 12%;
}

::v-deep .conditionsTxt .el-collapse-item__header,
::v-deep .conditionsTxt .el-collapse-item__header.focusing{
  font-size: 14px;
  font-weight: 600;
  color: #2E3F5E;
  padding: 15px 0;
  border-bottom: 1px solid #EBEEF5;
}
::v-deep .conditionsTxt .el-collapse-item__content{
  padding-bottom: 0;
}
::v-deep .conditionsTxt .el-icon-arrow-right:before{
  content: "\E790";
}
::v-deep .conditionsTxt .el-collapse-item__arrow.is-active{
  transform: rotate(180deg);
}

.conditionsTxt ul>li{
  display: flex;
  flex-wrap: wrap;
  font-size: 14px;
  padding: 10px 0;
  border-bottom: 1px solid #EBEEF5;
  color: #2E3F5E;
}
.conditionsTxt ul>li i{
  display: block;
  width: 12%;
  font-style: normal;
  line-height: 36px;
}
.conditionsTxt ul>li p{
  width: 68%;
  line-height: 36px;
}
.conditionsTxt ul>li .el-select{
    width: 20%;
}
::v-deep .conditionsTxt ul>li .el-select .el-input__inner{
    padding-left: 10px;
    padding-right: 10px;
}
.el-scrollbar .el-select-dropdown__item{
   padding-left: 10px;
}
.el-scrollbar .el-select-dropdown__item.selected,
.el-scrollbar .el-select-dropdown__item.hover{
    color: #F87A23;
}
.conditionsTxt ul>li:last-child{
  border-bottom: 0;
}

/* 抽屉样式 */ 
.conditionsTxt.drawerBox h3{
  margin-top: 0;
}
::v-deep .el-drawer__header{
    border-bottom: 1px solid #EFEFEF;
    padding-bottom: 15px;
    margin-bottom: 20px;
}
::v-deep .el-drawer__header>span{
    font-size: 18px;
    font-weight: bold;
    color: #2E3F5E;
    padding-left: 20px;
    background: url('~@/wss/assets/image/icon/cardLeft.png') left center no-repeat;
    background-size: 7px;
}

.conditionsTxt.drawerBox h3>p:nth-child(1){
  width: 10%;
}
.conditionsTxt.drawerBox h3>p:nth-child(2){
  width: 7%;
}
.drawerEdit h4{
  display: flex;
  align-items: center;
  margin: 8px 0;
}
.drawerEdit i.el-icon-remove{
  width: 8%;
  color: #909AAA;
  font-size: 14px;
  cursor: pointer;
}
.drawerEdit i.el-icon-remove.isDisabled{
    opacity: 0.5;
}

.conditionsTxt .drawerEdit ul>li{
  align-items: center;
  padding: 8px 0;
  border-top: 1px solid #EBEEF5;
  border-bottom: 0;
}
.conditionsTxt .drawerEdit ul>li>p{
  width: 8%;
  text-align: center;
}
.conditionsTxt .drawerEdit ul>li>.el-input{
  width: 84%;
}
.drawerEdit .drawerAdd{
  padding: 15px 0;
  border-top: 1px solid #EBEEF5;
  border-bottom: 1px solid #EBEEF5;
}
.drawerEdit .drawerAdd i{
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  width: 12.5px;
  height: 12.5px;
  border: 1px solid #909AAA;
  color: #909AAA;
  margin-left: 11%;
  cursor: pointer;
}
/* 抽屉样式 end */

/* 需求 */
.demandDrawer.conditionsTxt h3>p:nth-child(3){
  width: 35%;
}
.demandDrawer.conditionsTxt .drawerEdit ul>li>.el-input:nth-child(3){
  margin-right: 3%;
}
.demandDrawer.conditionsTxt .drawerEdit ul>li>.el-input{
  width: 40%;
}

/* 步骤 */
.stepDrawer.conditionsTxt h3>p:nth-child(3){
  width: 50%;
}
.stepDrawer.conditionsTxt h3>p:nth-child(4){
  flex-grow: 1;
  text-align: right;
}

.stepDrawer.conditionsTxt .drawerEdit ul>li>.el-input:nth-child(3){
  width: 45%;
  margin-right: 5%;
}
.stepDrawer.conditionsTxt .drawerEdit ul>li>.el-input:nth-child(4){
  width: 15%;
  margin-left: auto;
}
/* 抽屉样式 end*/ 

/* 项目需求 */
.demandbox h3>p:nth-child(2),
.demandbox h3>p:nth-child(3){
  width: 44%;
}

.demandbox ul>li p{
  width: 44%;
}

/* 流程步骤 */
.conditionsTxt.stepbox ul>li{
    color: #ACB6C7;
    cursor: pointer;
}
.conditionsTxt.stepbox ul>li.isUnder{
    color: #F87A23;
}
.conditionsTxt.stepbox ul>li.isSuccee{
    color: #0CA454;
}
.stepbox h3>p:nth-child(2){
  width: 36%;
}
.stepbox h3>p:nth-child(3){
  width: 16%;
}
.stepbox h3>p:nth-child(4){
  width: 18%;
}
.stepbox h3>p:nth-child(5){
  width: 18%;
}

.stepbox ul>li p:nth-child(2){
  width: 36%;
}
.stepbox ul>li p:nth-child(3){
  width: 16%;
}
.stepbox ul>li p:nth-child(4){
  width: 18%;
}
.stepbox ul>li p:nth-child(5){
  width: 18%;
}

/* 点击一条流程步骤的抽屉 */
.stepProcess{
    padding: 0 20px 20px;
    height: 100%;
}
/* 点击一条流程步骤的抽屉 end */

/* 更改记录的样式 */
.record{
    font-size: 12px;
    cursor: pointer;
}

/* 右侧按钮样式 */
::v-deep .subBtn{
  justify-content: space-between;
  align-items: center;
  padding: 8px 30px!important;
  z-index: 99;
}
::v-deep .subBtn>.el-button{
  width: 100px;
  padding: 8px 0!important;
  font-size: 14px;
  color: #606E84;
}
::v-deep .subBtn>.el-button.el-button--primary{
  background-color: #F87A23;
  border-color: #F87A23;
  color: #fff;
}
</style>

<style scoped>
/* 树状结构样式 */
.el-tree >>> .el-tree-node {
  position: relative;
}
.el-tree >>> .el-tree-node__expand-icon {
  display: none;
}
.el-tree >>> .el-tree-node__content {
  width: 100%;
  height: auto;
  padding-left: 0 !important;
}
.el-tree .custom-tree-node {
  width: 100%;
  padding: 8px 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  border-bottom: 1px solid #f5f7fa;
  cursor: move;
}
.el-tree .el-icon-remove {
  width: 8%;
  color: #909aaa;
  cursor: pointer;
}
.el-tree .el-icon-remove.isEdit{
  visibility: hidden;
}
.el-tree .treeNum {
  width: 8%;
  text-align: center;
  font-size: 14px;
}
.el-tree .el-input {
  flex: 1;
}
.el-tree .el-input.groupInput{
  flex: none;
  width: 84%;
  margin-left: auto;
}
.el-tree .custom-tree-node .el-input:nth-child(3){
  width: 30%;
  margin-right: 5%;
  flex: inherit;
}

.el-tree .drawerAdd {
  width: 100%;
  position: absolute;
  bottom: 0px;
  padding-bottom: 10px;
  border-bottom: 1px solid #f5f7fa;
}
.el-tree .drawerAdd > svg {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: #909aaa;
  margin-left: 10%;
  cursor: pointer;
}

.el-tree >>> .el-tree-node:focus > .el-tree-node__content,
.el-tree >>> .el-tree-node > .el-tree-node__content:hover {
  background-color: #fff;
}

::v-deep .el-tree > .el-tree-node > .el-tree-node__children {
  padding-bottom: 40px;
}
/* 树状结构样式 end */
</style>